package com.workplan.client.widgets.leftpanel;

import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.widget.WidgetPresenter;

import com.workplan.client.widgets.tabs.AssembleStaffTab;
import com.workplan.client.widgets.tabs.AssembleStaffTabPresenterImpl;
import com.workplan.client.widgets.tabs.DefineWorkweekTab;
import com.workplan.client.widgets.tabs.DefineWorkweekTabPresenterImpl;
import com.workplan.client.widgets.tabs.KeepInTouchTab;
import com.workplan.client.widgets.tabs.KeepInTouchTabPresenterImpl;
import com.workplan.client.widgets.tabs.PlanShiftsTab;
import com.workplan.client.widgets.tabs.PlanShiftsTabPresenterImpl;
import com.workplan.client.widgets.tabs.TabPresenter;
import com.workplan.client.widgets.userinfo.UserInfo;
import com.workplan.client.widgets.userinfo.UserInfoPresenter;
import com.workplan.client.widgets.userinfo.UserInfoPresenterImpl;

public class LeftPanelPresenterImpl extends
		WidgetPresenter<LeftPanelPresenter.Display> implements
		LeftPanelPresenter {

	public LeftPanelPresenterImpl(Display display, EventBus eventBus) {
		super(display, eventBus);
	}

	@Override
	protected void onBind() {
		createAndSetWidgets();
		display.init();
	}

	private void createAndSetWidgets() {
		UserInfo userInfo = new UserInfo();
		UserInfoPresenter userInfoPresenter = new UserInfoPresenterImpl(
				userInfo, eventBus);
		userInfoPresenter.bind();
		display.setUserInfo(userInfoPresenter.getDisplay());

		AssembleStaffTab assembleStaffTab = new AssembleStaffTab();
		TabPresenter assembleStaffPresenter = new AssembleStaffTabPresenterImpl(
				assembleStaffTab, eventBus);
		assembleStaffPresenter.bind();
		display.setAssembleStaff(assembleStaffPresenter.getDisplay());

		DefineWorkweekTab tab2 = new DefineWorkweekTab();
		TabPresenter tabP2 = new DefineWorkweekTabPresenterImpl(tab2, eventBus);
		tabP2.bind();
		display.setDefineWorkweek(tabP2.getDisplay());

		PlanShiftsTab tab3 = new PlanShiftsTab();
		TabPresenter tabP3 = new PlanShiftsTabPresenterImpl(tab3, eventBus);
		tabP3.bind();
		display.setPlanShifts(tabP3.getDisplay());

		KeepInTouchTab tab4 = new KeepInTouchTab();
		TabPresenter tabP4 = new KeepInTouchTabPresenterImpl(tab4, eventBus);
		tabP4.bind();
		display.setKeepInTouch(tabP4.getDisplay());

	}

	@Override
	protected void onUnbind() {
		// TODO Auto-generated method stub

	}

	@Override
	protected void onRevealDisplay() {
		// TODO Auto-generated method stub

	}

}
